/* global axios */
import ApiClient from './ApiClient'

export class TeamsAPI extends ApiClient {
  constructor () {
    super('teams', { accountScoped: true })
  }

  getAgents ({ teamId }) {
    return axios.get(`${this.url}/${teamId}/teamMembers`)
  }

  addAgents ({ teamId, agentsList }) {
    return axios.post(`${this.url}/${teamId}/teamMembers`, {
      userIds: agentsList,
    })
  }

  updateAgents ({ teamId, agentsList }) {
    return axios.patch(`${this.url}/${teamId}/teamMembers`, {
      userIds: agentsList,
    })
  }
}

export default new TeamsAPI()
